chrome.contextMenus.create({
    title: '查询该留言手机、IP信息', //菜单的名称
    id: '1',//二级菜单的id
    contexts: ['all'],
    //只允许固定url展示
    documentUrlPatterns: ['https://wz.mala.cn/wz/wzinfo?wid=*'],
});
chrome.contextMenus.create({
    title: '查询操作记录', //菜单的名称
    id: '2',//二级菜单的id
    contexts: ['all'],
    //只允许固定url展示
    documentUrlPatterns: ['https://wz.mala.cn/wz/wzinfo?wid=*'],
});
chrome.contextMenus.onClicked.addListener((menuInfo, tab) => {
    if (menuInfo.menuItemId == 1) {
        chrome.storage.local.get(['wzData']).then(function (res) {
            let user = res.wzData
            if (user?.userToken) {
                chrome.tabs.sendMessage(tab.id, {'action': 'lookwz'}, function (response) {
                });
            } else {
                chrome.action.openPopup()
            }
        })
    }
})
